class HttpException extends Error {
	constructor(msg = '服务器异常', errorCode = 5000, status = 500) {
		super()
		this.msg = msg
		this.errorCode = errorCode
		this.status = status
	}
}

HttpException.NotFound = class NotFound extends HttpException {
	constructor(msg = '资源未找到', errorCode = 4004, status = 404) {
		super()
		this.msg = msg
		this.errorCode = errorCode
		this.status = status
	}
}

HttpException.Forbbiden = class Forbbiden extends HttpException {
	constructor(msg, errorCode) {
		super()
		this.msg = msg || '权限不足'
		this.errorCode = errorCode || 4003
		this.status = 403
	}
}

HttpException.ParamsError = class ParamsError extends HttpException{
	constructor(msg, errorCode){
			super()
			this.msg = msg || '参数错误'
			this.errorCode = errorCode || 4000
			this.status = 400
	}
}

module.exports = HttpException
